package com.uam.utils;

/**
 * @author uam
 * @create 2023/12/3 19:46
 * @email uam@uam.com
 */

import com.uam.common.exception.CustomException;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class CSVReader {
    public static List<String> readCSV2List(String fileUrl) {
        List<String> res = new ArrayList<>();
        String line;

        try (BufferedReader br = new BufferedReader(new FileReader(fileUrl))) {
            while ((line = br.readLine()) != null) {
                res.add(line);
            }
        } catch (IOException e) {
            throw new CustomException("csv文件处理失败");
        }
        return res;
    }
}